#include<iostream>
#include<algorithm>
using namespace std;

int main(int argc, char const *argv[])
{
    int N,B,count=0;;
    scanf("%d %d",&N,&B);
    int Arr[N];
    for (int i = 0; i < N; i++)
    {
        scanf("%d",&Arr[i]);
    }
    sort(Arr,Arr+N);
    for (int i = N-1; i >= 0; i--)
    {
        count += Arr[i];
        if (count >= B) {
            printf("%d",N-i);
            break;
        } 
    }
    return 0;
}
